﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.ComponentModel;


namespace CommonDataContracts
{
    [DataContract]
    public class BacteriumSnapshot : INotifyPropertyChanged
    {
        #region Fields

        private String _id;
        private int _teamID;
        private int _power;
        private BacteriumAction _currentAction;
        private Boolean _isAttacked;
        private Boolean _isSupported;

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Data Members

        [DataMember]
        public String ID
        {
            get { return _id; }
            set { _id = value; NotifyChanged("ID"); }
        }

        [DataMember]
        public int TeamID
        {
            get { return _teamID; }
            set { _teamID = value; NotifyChanged("TeamID"); }
        }

        [DataMember]
        public int Power
        {
            get { return _power; }
            set { _power = value; NotifyChanged("Power"); }
        }

        [DataMember]
        public BacteriumAction CurrentAction
        {
            get { return _currentAction; }
            set { _currentAction = value; NotifyChanged("CurrentAction"); }
        }

        [DataMember]
        public Boolean IsAttacked
        {
            get { return _isAttacked; }
            set { _isAttacked = value; NotifyChanged("IsAttacked"); }
        }

        [DataMember]
        public Boolean IsSupported
        {
            get { return _isSupported; }
            set { _isSupported = value; NotifyChanged("IsSupported"); }
        }
        #endregion

        protected void NotifyChanged(String name)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(name));
            }
        }

    }
}
